/*
 * Copyright 2010 Alessandro Bellucci
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.soupframework.gwt.designerpanel.client.command.impl;

import org.soupframework.gwt.designerpanel.client.command.Command;
import org.soupframework.gwt.designerpanel.client.command.CommandFactory;
import org.soupframework.gwt.designerpanel.client.command.CommandGroup;
import org.soupframework.gwt.designerpanel.client.designer.ContainerDesigner;
import org.soupframework.gwt.designerpanel.client.designer.impl.AbsolutePanelViewDesigner;
import org.soupframework.gwt.designerpanel.client.designer.impl.CaptionPanelViewDesigner;
import org.soupframework.gwt.designerpanel.client.designer.impl.FlowPanelViewDesigner;
import org.soupframework.gwt.designerpanel.client.designer.impl.HorizontalPanelViewDesigner;
import org.soupframework.gwt.designerpanel.client.designer.impl.SimplePanelViewDesigner;
import org.soupframework.gwt.designerpanel.client.designer.impl.VerticalPanelViewDesigner;

public class CommandFactoryImpl<T> implements CommandFactory<T> {

	@Override
	public CommandGroup createCommandGroup(String commandGroupType){
		return new CommandGroupImpl(commandGroupType);
	}

	@Override
	public Command createAddObjectCommand(ContainerDesigner<T> designer, T object, int left, int top){
		return new ContainerAddObjectCommand<T>(designer, object, left, top);
	}

	@Override
	public Command createResizeObjectViewCommand(ContainerDesigner<T> designer, T object, int width, int height) {
		return new ContainerResizeObjectViewCommand<T>(designer, object, width, height);
	}

	@Override
	public Command createRemoveObjectCommand(ContainerDesigner<T> designer, T object){
		return new ContainerRemoveObjectCommand<T>(designer, object);
	}

	@Override
	public Command createMoveFromContainerCommand(ContainerDesigner<T> designer, ContainerDesigner<T> sourceDesigner, T object, int left, int top) {
		return new ContainerMoveFromContainerCommand<T>(designer, sourceDesigner, object, left, top);
	}

	@Override
	public Command createClearCommand(ContainerDesigner<T> designer){
		return new ContainerClearCommand<T>(designer);
	}

	@Override
	public Command createMoveCommand(AbsolutePanelViewDesigner<T> designer, T object, int deltaX, int deltaY, boolean blockGridAlignment){
		return new AbsolutePanelMoveCommand<T>(designer, object, deltaX, deltaY, blockGridAlignment);
	}

	@Override
	public Command createAlignToGridCommand(AbsolutePanelViewDesigner<T> designer, T object){
		return new AbsolutePanelAlignToGridCommand<T>(designer, object);
	}

	@Override
	public Command createSetChildObjectCommand(SimplePanelViewDesigner<T> designer, T object){
		return new SimplePanelSetChildObjectCommand<T>(designer, object);
	}

	@Override
	public Command createSetContentCommand(CaptionPanelViewDesigner<T> designer, T object){
		return new CaptionPanelSetContentCommand<T>(designer, object);
	}

	@Override
	public Command createHorizontalExchangeCommand(HorizontalPanelViewDesigner<T> designer, T object1, T object2){
		return new HorizontalPanelExchangeCommand<T>(designer, object1, object2);
	}

	@Override
	public Command createVerticalExchangeCommand(VerticalPanelViewDesigner<T> designer, T object1, T object2){
		return new VerticalPanelExchangeCommand<T>(designer, object1, object2);
	}

	@Override
	public Command createFlowPanelExchangeCommand(FlowPanelViewDesigner<T> designer, T object1, T object2){
		return new FlowPanelExchangeCommand<T>(designer, object1, object2);
	}
}
